package com.qr;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import com.qr.pubsub.wmyw.SubThreadWmyw;

/**
 * @author: zc
 * email: zc8023zs@163.com
 * create_time: 2020/8/13 10:20:40
 * wmyw 模块的订阅和发布
 */
@Configuration
public class PubSubConfigWmyw {
    @Value("${spring.redis.host:127.0.0.1}")
    private String springRedisHost;
    @Value("${spring.redis.port:6379}")
    private int springRedisPort;
    @Value("${spring.redis.timeout:6000}")
    private int springRedisTimeout;
    @Value("${spring.redis.password:}")
    private String springRedisPassword;

    @Bean
    @Scope
    public SubThreadWmyw subThreadWmyw() {
        SubThreadWmyw subThread = new SubThreadWmyw(springRedisHost,springRedisPort,springRedisTimeout,springRedisPassword); // wmyw消息订阅者
        subThread.start();
        return subThread;
    }
}